import React, { Component } from 'react';
import { NavLink } from 'react-router-dom';
import { withRouter } from 'react-router-dom'

class NewsTitle extends Component {
    constructor(props) {
        super(props);
        this.state = {  }
    }
    static defaultProps={
        id:1,
        title:"moren title"
    }
    render() { 
        return ( 
            <li>
                {/* <NavLink to={
                    {
                        pathname:"/news/" + this.props.id,
                        state:{title:this.props.title}
                    }
                }
                > {this.props.title} </NavLink>  */}
                <span onClick={
                    ()=>{
                        this.props.history.push({pathname:"/news/"+this.props.id})
                    }
                }> { this.props.title } <b>已阅读{this.props.readCount}次</b></span>
            </li>

        );
    }
}
 
export default withRouter(NewsTitle);